import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {AppComponent} from './app.component';
// Import routing module
import {AppRoutes} from './app.routes';
import {LogoutComponent} from "./components/app-logout/logout.component";
// Import containers
import {AuthGuard} from "./service/authGuard";
import {MessageService} from "./service/messageService";
import {UserService} from "./service/userService";
import {SharedModules} from "./shared/sharedModules";
import {Store} from "./store/Store";
import {TabBarModule} from "./shared/component/tabBar/tabBar.module";
import {AppLoginComponent} from "./login/appLogin.component";
import {DialogService} from "./service/dialogService";
import {DashboardModule} from "./views/dashboard/dashboard.module";
import {CCRiskControllerService} from "./service/CCRiskController";
import { JwtModule } from '@auth0/angular-jwt';
import { HttpClientModule } from '@angular/common/http';
import {FileService} from "./service/fileService";
import {JsSdkService} from "./service/jsSdkService";
import {QrCodeScanComponent} from "./views/qrcode-scan/qrcode-scan.component";
import {SMSService} from "./service/smsService";

// Import 3rd party components
export function tokenGetter () {
  return localStorage.getItem('token');
}

@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        AppRoutes,
        SharedModules,
        DashboardModule,
        TabBarModule,
        HttpClientModule,
        JwtModule.forRoot({
          config: {
            tokenGetter: tokenGetter,
            whitelistedDomains: ['localhost:8087', '192.168.21.33:8087', '122.144.213.28:8090', '127.0.0.1:8087', '192.168.6.113:8087',
              '127.0.0.1:8099', '192.168.6.113:8099', '114.55.38.236:8099', 'wechat.fuyitianjian.cn', '140.207.223.107:8087']
          }
        })
    ],
    declarations: [
        AppComponent,
        LogoutComponent,
        AppLoginComponent,
        QrCodeScanComponent
    ],
    providers: [
        MessageService,
        UserService,
        AuthGuard,
        Store,
        DialogService,
        CCRiskControllerService,
        FileService,
        JsSdkService,
        SMSService
        // {
        //   provide: Environment,
        //   useFactory: getEnv
        // },
        // {
        //     provide: LocationStrategy,
        //     useClass: HashLocationStrategy
        // }
    ],
    bootstrap: [AppComponent]
})
export class AppModule {
  constructor() {
    localStorage.setItem('initURL', location.href);
  }
}
